<!DOCTYPE html>
<html>
<head>
    <title>work_item</title>
    <#include "/sys/header.html"/>
</head>
<body>
<div class="panel panel-default" id="rrapp" v-cloak>
    <div class="panel-heading">{{title}}</div>
    <form class="form-horizontal">
        <div class="form-group">
            <div class="col-sm-2 control-label">名称</div>
            <div class="col-sm-10">
                <input type="text" class="form-control" v-model="work.workName" placeholder="名称"/>
            </div>
        </div>
        <div class="form-group">
            <div class="col-sm-2 control-label">作业专题</div>
            <div class="col-sm-10">
                <select class="form-control" v-model="work.subjectId" placeholder="作业专题">
                    <option value=""></option>
                    <template v-for="option in subjectList">
                        <option :value="option.dictCode" v-if="option.dictCode == work.subjectId" selected>
                            {{ option.dictName }}
                        </option>
                        <option :value="option.dictCode" v-else>
                            {{ option.dictName }}
                        </option>
                    </template>
                </select>
            </div>
        </div>
        <div class="form-group">
            <div class="col-sm-2 control-label">依赖类型</div>
            <div class="col-sm-10">
                <select class="form-control" v-model="work.referType" placeholder="依赖类型" @change="changeReferType">
                    <template v-for="option in workRefer">
                        <option :value="option.dictCode" v-if="option.dictCode == work.referType" selected>
                            {{ option.dictName }}
                        </option>
                        <option :value="option.dictCode" v-else>
                            {{ option.dictName }}
                        </option>
                    </template>
                </select>
            </div>
        </div>
        <div class="form-group" v-show="work.referType == 'referTaskId' ? true : false">
            <div class="col-sm-2 control-label">关联作业</div>
            <div class="col-sm-10">
                <template>
                    <el-select v-model="referWorkId" multiple placeholder="请选择" style="width:100%;border:1px">
                        <el-option
                                v-for="item in works"
                                :key="item.value"
                                :label="item.label"
                                :value="item.value">
                        </el-option>
                    </el-select>
                </template>
            </div>
        </div>
        <div class="form-group" v-show="work.referType == 'referSql' ? true : false">
            <div class="col-sm-2 control-label">依赖sql</div>
            <div class="col-sm-10">
                <textarea rows="3" class="form-control" v-model="work.referSql" placeholder="依赖sql"></textarea>
            </div>
        </div>
        <div class="form-group">
            <div class="col-sm-2 control-label">失败策略</div>
            <div class="col-sm-10">
                <select class="form-control" v-model="work.misfire" placeholder="失败策略">
                    <template v-for="option in misfire">
                        <option :value="option.dictCode" v-if="option.dictCode == work.misfire" selected>
                            {{ option.dictName }}
                        </option>
                        <option :value="option.dictCode" v-else>
                            {{ option.dictName }}
                        </option>
                    </template>
                </select>
            </div>
        </div>

        <div class="form-group">
            <div class="col-sm-2 control-label">级别</div>
            <div class="col-sm-10">
                <select class="form-control" v-model="work.levelNum" placeholder="级别">
                    <template v-for="option in levels">
                        <option :value="option.dictCode" v-if="option.dictCode == work.levelNum" selected>
                            {{ option.dictName }}
                        </option>
                        <option :value="option.dictCode" v-else>
                            {{ option.dictName }}
                        </option>
                    </template>
                </select>
            </div>
        </div>

        <div class="form-group">
            <div class="col-sm-2 control-label">执行参数</div>
            <div class="col-sm-10">
                <select class="form-control" v-model="work.paramsId" placeholder="执行参数">
                    <option value="" ></option>
                    <template v-for="option in workPrivateParams">
                        <option :value="option.dictId" v-if="option.dictId == work.paramsId" selected>
                            {{ option.dictValue }}
                        </option>
                        <option :value="option.dictId" v-else>
                            {{ option.dictValue }}
                        </option>
                    </template>
                </select>
            </div>
        </div>
        <div class="form-group">
            <div class="col-sm-2 control-label">状态</div>
            <div class="col-sm-10">
                <label class="radio-inline">
                    <input type="radio" name="status" value="0" v-model="work.status"/> 停用
                </label>
                <label class="radio-inline">
                    <input type="radio" name="status" value="1" v-model="work.status"/> 正常
                </label>
            </div>
        </div>
        <div class="form-group">
            <div class="col-sm-2 control-label">描述</div>
            <div class="col-sm-10">
                <input type="text" class="form-control" v-model="work.remark" placeholder="描述"/>
            </div>
        </div>
        <div class="form-group" v-show="work.createTime ? true : false">
            <div class="col-sm-2 control-label">创建时间</div>
            <div class="col-sm-10">
                <label class="form-control">{{ work.createTime }}</label>
            </div>
        </div>
        <div class="form-group" v-show="work.updateTime ? true : false">
            <div class="col-sm-2 control-label">更新时间</div>
            <div class="col-sm-10">
                <label class="form-control"> {{ work.updateTime }}</label>
            </div>
        </div>
        <div class="form-group">
            <div class="col-sm-2 control-label"></div>
            <input type="button" class="btn btn-primary" @click="saveOrUpdate" value="确定"/>
            &nbsp;&nbsp;<input type="button" class="btn btn-warning" @click="back" value="返回"/>
        </div>
    </form>
</div>

<script src="${base}/js/work/work_add.js?_${.now?string['yyyyMMddhhmmSS']}"></script>
</body>
</html>
